<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: emWin Overview</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('page_emwin_overview.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">emWin Overview </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1>What is emWin?</h1>
<p>emWin is an embedded graphic library and graphical user interface (GUI) framework designed to provide an efficient, processor- and LCD controller-independent GUI for any application that operates with a graphical display. It is compatible with single-task and multitask environments. Developed by SEGGER Microcontroller, emWin is extremely popular in the embedded industry. Infineon has licensed the emWin library from SEGGER and offers it for free to customers. The emWin User &amp; Reference Guide located <a href="../../UM03001_emWin5.pdf">here</a>.</p>
<h1>Supported Features</h1>
<ul>
<li>2-D Graphics Library</li>
<li>Displaying bitmap files</li>
<li>Fonts</li>
<li>Memory Devices</li>
<li>Multitask (RTOS)</li>
<li>Window Manager</li>
<li>Window Objects (Widgets)</li>
<li>Virtual Screens / Virtual Pages</li>
<li>Pointer Input Devices<ul>
<li>Touch screen support (user defined)</li>
<li>Sprites and Cursors</li>
</ul>
</li>
<li>Antialiasing</li>
<li>Language Support<ul>
<li>Multi-codepages support</li>
<li>Unicode support</li>
<li>Right-to-left and bidirectional text support</li>
</ul>
</li>
<li>Drivers<ul>
<li>Compact Color</li>
<li>Flex Color</li>
<li>BitPlains</li>
<li>Control - Infineon custom driver for GraphicLCDCtrl Component to support displays without controller and VRAM.</li>
</ul>
</li>
</ul>
<h1>Available Options</h1>
<p>emWin has the following component options:</p>
<ul>
<li><p class="startli">Core - defines RTOS or Touchscreen support. Available options: </p><table class="doxtable">
<tr>
<th align="left">Option </th><th align="center">OS </th><th align="center">Touch Screen  </th></tr>
<tr>
<td align="left">nOSnTS </td><td align="center">NO </td><td align="center">NO </td></tr>
<tr>
<td align="left">nOSTS </td><td align="center">NO </td><td align="center">YES </td></tr>
<tr>
<td align="left">OSnTS </td><td align="center">YES </td><td align="center">NO </td></tr>
<tr>
<td align="left">OSTS </td><td align="center">YES </td><td align="center">YES </td></tr>
</table>
<p>Additionally, in the ModusToolbox&trade; you can select SoftFP or HardFP versions of all specified options.</p>
<dl class="section note"><dt>Note</dt><dd>When emWin core with RTOS support is selected, an GUI_X_RTOS.c configuration file is added to the project. By default, GUI_X_RTOS.c is configured to work with FreeRTOS. Modify this file to use emWin with any other RTOS.</dd>
<dd>
For multitasking support, emWin uses a FreeRTOS mutex resource. To enable FreeRTOS mutex support, set configUSE_MUTEXES to 1 in the FreeRTOSConfig.h file.</dd></dl>
</li>
<li>Display Driver - defines different display support. Available options: FlexColor, CompactColor_16, BitPlains, Control.</li>
</ul>
<h1>Using emWin in a PSoC&trade; Creator project</h1>
<ol type="1">
<li>Enable emWin in the PDL pack settings, and choose the following options: OS and Touch support, Display Driver. <div class="image">
<img src="emWin_build_settings.png" alt="emWin_build_settings.png"/>
<div class="caption">
Figure 1. emWin settings</div></div>
</li>
<li>Choose a display interface for communicating with the display. For PSoC&trade; Creator, you can place the desired interface Component like GraphicLCDIntr, GraphicLCDCntrl, SPI, or I2C in the TopDesign schematic and configure it with the Component customizer. Alternatively, you can implement a custom interface.</li>
<li>Generate the application code. All configuration files will be added to your project.</li>
</ol>
<h1>Using emWin in a ModusToolbox&trade; project</h1>
<ol type="1">
<li>Open the Middleware Selector from the required mainapp project. Select emWin Core and emWin Display Driver components.</li>
<li>Click OK. The Middleware Selector adds the emWin config files to the selected project.</li>
</ol>
<h1>emWin Basic Configuration</h1>
<ol type="1">
<li>Specify the LCD resolution, color conversion, and other required LCD settings in the LCDConfig.c file.</li>
<li>Modify the emWin config files for the required display driver interface access functions. For details on the display access API, refer to Chapter 33 <b>Display Drivers</b> of <a href="../../UM03001_emWin5.pdf">emWin User &amp; Reference Guide</a>:<ul>
<li><b>CompactColor_16 driver:</b> specify the LCD_WRITE... and LCD_READ... macros of the LCDConf_CompactColor_16.h file. For example, to initialize the GraphicLCDIntf Component in 8-bit mode: <div class="fragment"><div class="line"><span class="preprocessor">#define LCD_WRITEM_A1(p, Num)       GraphicLCDIntf_1_WriteM8_A1(p, Num)</span></div><div class="line"><span class="preprocessor">#define LCD_WRITEM_A0(p, Num)       GraphicLCDIntf_1_WriteM8_A0(p, Num)</span></div><div class="line"><span class="preprocessor">#define LCD_READM_A1(p, Num)        GraphicLCDIntf_1_ReadM8_A1(p, Num)</span></div><div class="line"><span class="preprocessor">#define LCD_WRITE_A0(Data)          GraphicLCDIntf_1_Write8_A0(Data)</span></div><div class="line"><span class="preprocessor">#define LCD_WRITE_A1(Data)          GraphicLCDIntf_1_Write8_A1(Data)</span></div></div><!-- fragment --></li>
<li><b>FlexColor driver:</b> Specify the list of the LCD interface access functions in the LCD_X_Config() function (LCDConfig.c file). For this, modify the GUI_PORT_API PortApi structure passed as the pointer to GUIDRV_FlexColor_SetFunc(). For example, to initialize the GraphicLCDIntf Component in 8-bit mode: <div class="fragment"><div class="line">GUI_PORT_API PortAPI = {0};</div><div class="line">…</div><div class="line">PortAPI.pfWrite8_A0  = GraphicLCDIntf_1_Write8_A0;</div><div class="line">PortAPI.pfWrite8_A1  = GraphicLCDIntf_1_Write8_A1;</div><div class="line">PortAPI.pfWriteM8_A1 = GraphicLCDIntf_1_WriteM8_A1;</div><div class="line">PortAPI.pfRead8_A1   = GraphicLCDIntf_1_Read8_A1;</div><div class="line">PortAPI.pfReadM8_A1  = GraphicLCDIntf_1_ReadM8_A1;</div><div class="line">GUIDRV_FlexColor_SetFunc(pDevice, &amp;PortAPI, LCD_CONTROLLER, GUIDRV_FLEXCOLOR_M16C0B8);</div></div><!-- fragment --></li>
<li><b>BitPlains driver</b>: only manage the content of the bit plains. It does not contain any display controller specific code. Implement your own display access and update routines.</li>
<li><b>Control driver</b>: No modification is needed. Instead, set all required display parameters in GraphicLCDCntrl Component customizer. <dl class="section note"><dt>Note</dt><dd>This driver is available only in PSoC&trade; Creator.</dd></dl>
</li>
</ul>
</li>
<li>Insert the initialization code for the display interface and the display driver IC in the _InitController() function of the LCDConf.c configuration file.</li>
<li>Include GUI.h header in your source file.</li>
<li>Call the GUI_Init() function to start emWin.</li>
<li>Call the drawing function.</li>
</ol>
<h1>emWin Example Projects</h1>
<p>The following code examples demonstrate how to use emWin, and work without modification:</p><ul>
<li>CE223726 - EmWin Graphics Library - TFT Display</li>
<li>CE223727 - EmWin Graphics Library - EInk Display</li>
</ul>
<p>Segger also provides many examples of emWin usage. These examples are in the <em>/libraries/psoc6sw-1.0/components/psoc6mw/emWin/sample</em> directory. To run an example:</p><ol type="1">
<li>Add one of the demo sample files to your project.</li>
<li>Configure emWin as described in the "emWin Basic Configuration" section.</li>
<li>Edit the main source file (main.c) to include GUI.h. Enable interrupts and then call MainTask() as shown in the code that follows. All of the emWin examples use MainTask() as the entry point. <div class="fragment"><div class="line"><span class="preprocessor">#include &quot;project.h&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;GUI.h&quot;</span> </div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div><div class="line">    __enable_irq();</div><div class="line">    MainTask();</div><div class="line">    <span class="keywordflow">for</span>(;;)</div><div class="line">    {</div><div class="line">        </div><div class="line">    }</div><div class="line">}</div></div><!-- fragment --></li>
<li>Build and run the project. </li>
</ol>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
